#include<stdio.h>
double f(int n);
int main(void)
{
	int N,count=0;
	
	printf("Enter N\n");
	scanf("%d",&N);
	
	count = f(N);
	
	printf("%d",count);
	
	return 0;
}
double f(int n)
{
	int result=0,solo,rest;
	
	for(int i=1;i<=n;i++){
		rest=i;
		while(rest!=0){
			solo=rest%10;
			rest=rest/10;
			if(solo==1) result++;
			}
			
		}
		return result;
	}
